﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace PloobsEngine.SceneControl
{
    public class RipplePostEffect : IPostEffect
    {

        Effect effect = null;
        private Vector2 center = new Vector2(0.5f);

        public Vector2 Center
        {
            get { return center; }
            set { center = value; }
        }
        private float rippleSize = 0.25f;

        public float RippleSize
        {
            get { return rippleSize; }
            set { rippleSize = value; }
        }
        private float intensity = 0.25f;

        public float Intensity
        {
            get { return intensity; }
            set { intensity = value; }
        }

        public void Draw(IRenderHelper rHelper,  Microsoft.Xna.Framework.GameTime gt, Microsoft.Xna.Framework.Rectangle screenRec, IWorld world)
        {
            effect.Parameters["Intensity"].SetValue(intensity);
            effect.Parameters["RippleSize"].SetValue(rippleSize);
            effect.Parameters["Point"].SetValue(center);           
            rHelper.RenderTextureToFullScreenSpriteBatch(PrincipalConstants.CurrentImage, effect,screenRec);
        }

        public void init(EngineStuff engine)
        {
            effect = EngineStuff.InternalContentManager.GetAsset<Effect>("Ripple");            
        }

    }
}
